package com.quad.innovators.salesease.controller.warehouse;

import com.quad.innovators.salesease.annotation.DataPermission;
import com.quad.innovators.salesease.annotation.FunctionPermission;
import com.quad.innovators.salesease.annotation.Log;
import com.quad.innovators.salesease.annotation.RepeatSubmit;
import com.quad.innovators.salesease.common.result.PageResultBean;
import com.quad.innovators.salesease.common.result.Result;
import com.quad.innovators.salesease.constants.SystemConstants;
import com.quad.innovators.salesease.enums.LogModuleEnum;
import com.quad.innovators.salesease.model.form.warehouse.PurchaseOrderForm;
import com.quad.innovators.salesease.model.query.warehouse.PurchaseOrderPageQuery;
import com.quad.innovators.salesease.model.vo.warehouse.PurchaseOrderVO;
import com.quad.innovators.salesease.service.warehouse.PurchaseOrderDetailService;
import com.quad.innovators.salesease.service.warehouse.PurchaseOrderService;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;

/**
 * @author : shanshan.li
 * @createTime : 2024/10/18 15:42
 * @Version : 1.0 
 */
@Tag(name = "15.采购单详情接口")
@RestController
@RequestMapping(SystemConstants.BACKEND_API + "/purchase-order-detail")
@RequiredArgsConstructor
public class PurchaseOrderDetailController {
    private final PurchaseOrderDetailService purchaseOrderDetailService;

    @Operation(summary = "修改付款状态")
    @PutMapping(value = "/{code}/status")
    @Parameters({
            @Parameter(name = "code", description = "code")
    })
    @FunctionPermission(permissionCode = "warehouse:purchase-order:edit")
    @DataPermission(permissionCode = "warehouse:purchase-order:data-permission")
    public Result<?> updateStatus(@PathVariable("code") String code) {
        boolean result = purchaseOrderDetailService.updateStatus(code);
        return Result.success(result);
    }
}
